//
//  YDQuestionTableCell.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2017/11/13.
//  Copyright © 2017年 LK-IOS. All rights reserved.
//

#import "YDQuestionTableCell.h"
#import "YDQuestionCellModel.h"


@interface YDQuestionTableCell()
//图片
@property (nonatomic , weak) UIImageView *titleImage;
//内容
@property (nonatomic , weak) UILabel *contentLabel;

@end

@implementation YDQuestionTableCell

-(void)setModel:(YDQuestionCellModel *)model
{
    _model = model;
    
    self.titleImage.frame = model.imageFrame;
    self.contentLabel.frame = model.titleFrame;
    
    self.contentLabel.attributedText = model.attrDetail;
    
    
}

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *questionTableCell = @"YDQuestionTableCell";
    YDQuestionTableCell *cell = [tableView dequeueReusableCellWithIdentifier:questionTableCell];
    if (cell == nil) {
        cell = [[YDQuestionTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:questionTableCell];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.backgroundColor = [UIColor whiteColor];
        
        [self titleImage];
        [self contentLabel];

    }
    return self;
}

-(UIImageView *)titleImage
{
    if (_titleImage == nil) {
        UIImageView *titleImage = [[UIImageView alloc] init];
        [self.contentView addSubview:titleImage];
        titleImage.contentMode = UIViewContentModeScaleAspectFill;
        titleImage.image = [UIImage imageNamed:@"home-da"];
        _titleImage = titleImage;
    }
    return _titleImage;
}

-(UILabel *)contentLabel
{
    if (_contentLabel == nil) {
        UILabel *contentLabel = [[UILabel alloc] init];
        [self.contentView addSubview:contentLabel];
        //104 114 132
        contentLabel.textColor = NumberColor(104, 114, 132);
        contentLabel.font = [UIFont systemFontOfSize:font14ScreenWRate * LKScreenW];
        contentLabel.textAlignment = NSTextAlignmentLeft;
        contentLabel.numberOfLines = 0;
        contentLabel.lineBreakMode = NSLineBreakByCharWrapping;
        _contentLabel = contentLabel;
    }
    return _contentLabel;
}
@end
